package cc.rengu.igas.channel.cups.core.realize;


import cc.rengu.oltp.service.common.entity.KeyInfo;

/**
 * 生成验证mac服务,银联cups
 *
 * @author Administrator
 */
public interface CupsMacService {
    /**
     * 生成mac
     *
     * @param keyInfo  KeyInfo
     * @param macBlock 生成mac的字符串
     * @return 生成的签名串
     * @throws Exception 失败
     */
    String genMacString(KeyInfo keyInfo, String macBlock) throws Exception;

    /**
     * 校验mac
     *
     * @param keyInfo  KeyInfo
     * @param mac      mac
     * @param macBlock 生成mac的字符串
     * @return true-成功，false-失败
     * @throws Exception 失败
     */
    boolean verifyMacString(KeyInfo keyInfo, String mac, String macBlock) throws Exception;

    /**
     * 校验mac-重置密钥专用
     *
     * @param keyInfo  KeyInfo
     * @param mac      mac
     * @param macBlock 生成mac的字符串
     * @return true-成功，false-失败
     * @throws Exception 失败
     */
    boolean verifyReSetKeyMacString(KeyInfo keyInfo, String mac, String macBlock) throws Exception;
}
